cmake_minimum_required(VERSION 3.17)
project(TeradataCptJni)

#set(CMAKE_C_STANDARD 99)
set(CMAKE_CXX_STANDARD 14)
set(PROJECT_INCLUDE ${CMAKE_SOURCE_DIR}/include)
set(JNI_INCLUDE $ENV{JAVA_HOME}/include)
if(WIN32)
    set(JNI_MD_INCLUDE $ENV{JAVA_HOME}/include/win32)
elseif(UNIX AND NOT APPLE)
    set(JNI_MD_INCLUDE $ENV{JAVA_HOME}/include/linux)
endif()

message("PROJECT_INCLUDE:${PROJECT_INCLUDE}")
message("JNI_INCLUDE:${JNI_INCLUDE}")
message("JNI_MD_INCLUDE:${JNI_MD_INCLUDE}")

include_directories(${PROJECT_INCLUDE} ${JNI_INCLUDE} ${JNI_MD_INCLUDE})
add_compile_options(-fPIC -D_REENTRANT)
#add_library(cpt src/cpt.c)
#add_library(TeradataCptJni SHARED src/cptjni.c)
#link_directories(TeradataCptJni cpt)

#add_library(TeradataCptJni SHARED src/cptjni.c src/cpt.o)
add_library(TeradataCptJni SHARED src/cptjni.cpp src/cpt.c src/register.cpp src/convert.cpp)

# Test
message("build TeradataCptJniTest")
set(TEST1 test/multiset_policy_test.c src/cpt.c)
add_executable(multiset_policy_test ${TEST1})

# Test2
message("build TeradataCptJniTest2")
set(TEST2 test/simple_single_test.c src/cpt.c)
add_executable(simple_single_test ${TEST2})
